home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_309 / sksh / diffs.doc < prev    next >
Text File  |  1992-05-06  |  7KB  |  265 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.                                 SKsh/ksh Differences
  17.  
  18.                                         SKSH
  19.  
  20.                            A ksh-like Shell for the Amiga
  21.  
  22.                                      Version 1.3
  23.  
  24.  
  25.                                (Copyright) 1989, 1990
  26.  
  27.                                      Steve Koren
  28.  
  29.                                    January 2, 1990
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.           Introduction
  74.  
  75.             This document describes some of the  differences  between  SKsh
  76.             and ksh under Unix.  It does not even begin to cover them  all.
  77.             If  you  need  to  have  specific  information,   compare   the
  78.             appropriate sections of the two manuals.
  79.  
  80.             In general, scripts may be written which run under either  SKsh
  81.             or ksh by testing the $SHELL parameter:
  82.  
  83.                if [ "$SHELL" = 'sksh' ]
  84.                then
  85.                  echo 'do some SKsh/AmigaDos specific things here'
  86.                elif [ "$SHELL" = '/bin/ksh' ]
  87.                then
  88.                  echo 'do some ksh/UNIX specific things here'
  89.                fi
  90.  
  91.  
  92.           Differences List
  93.  
  94.             Alias and Function Resolution
  95.  
  96.                SKsh  resolves  alias  and  function  names  when  they  are
  97.                logically encountered.  ksh  resolves  them  when  they  are
  98.                physically encountered.  This leads to different  behaviours
  99.                in functions.  For  example,  in  SKsh,  you  can  define  a
  100.                function that uses  an  alias  that  you  define  after  the
  101.                function.  As long  as  the  alias  is  defined  before  the
  102.                function is executed  (but  not  necessarily  before  it  is
  103.                defined), SKsh will execute the alias normally.  In ksh,  on
  104.                the other hand, the alias must be defined as such  when  the
  105.                function is defined, not when it is executed.
  106.  
  107.  
  108.             Assignment Syntax
  109.  
  110.                SKsh permits spaces to surround the  '='  in  an  assignment
  111.                statement.  ksh does not.
  112.  
  113.  
  114.             ${var:val} Operations
  115.  
  116.                ksh has a bunch of  variable  binding  operators  that  look
  117.                like the above, and permit tests and assignments to be  made
  118.                in one step.  SKsh does not support any of these.
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.           SKSH Amiga Shell             Page 2          Ash/ksh Differences
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.             vi mode
  140.  
  141.                ksh has a command line editing mode that is  similar  to  vi
  142.                bindings.  SKsh has only the emacs bindings.  I may, in  the
  143.                future, permit user defined bindings, but this is  not  high
  144.                on my priority list of things to do.
  145.  
  146.                In addition,  SKsh  emacs  command  line  editing,  although
  147.                quite useful, is limited compared  to  that  of  ksh.   SKsh
  148.                does not permit cut and paste between lines, etc.  A few  of
  149.                the commands also work differently (such as  the  ^r  search
  150.                command).
  151.  
  152.  
  153.             In-line parameter assignment
  154.  
  155.                ksh permits variables to be assigned to while being used  as
  156.                a parameter.  For example,
  157.  
  158.                  export COLUMNS=80
  159.  
  160.                SKsh does not permit this.  You must perform the  assignment
  161.                and export separately.
  162.  
  163.  
  164.             Job Control
  165.  
  166.                ksh has job control.  SKsh does not.
  167.  
  168.  
  169.             Path Separator Character
  170.  
  171.                ksh uses ':' as  a  path  separator  character.   Since  the
  172.                colon is a legal character in AmigaDos path names,  a  comma
  173.                is used instead.
  174.  
  175.  
  176.             Function Definition Syntax
  177.  
  178.                The SKsh function definition  syntax  using  the  'function'
  179.                keyword is compatible with ksh,  but  ksh  also  permits  an
  180.                alternate syntax using 'function() { }' that SKsh does not.
  181.  
  182.  
  183.             Set vs. Options
  184.  
  185.                ksh uses the 'set' keyword  to  set  options  to  the  shell
  186.                itself.  SKsh uses  'set'  to  list  alias,  variables,  and
  187.                functions.  SKsh uses the  'option'  command  to  set  shell
  188.                options.  These options are, with  only  a  few  exceptions,
  189.                different from their ksh counterparts.
  190.  
  191.  
  192.  
  193.  
  194.  
  195.           SKSH Amiga Shell             Page 3          Ash/ksh Differences
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.             Scoping Rules
  206.  
  207.                The SKsh scoping rules are different than the scoping  rules
  208.                in in ksh.  Ksh supports the  'typeset'  keyword  to  create
  209.                local variables; SKsh controls this with an option flag  and
  210.                the 'local' command.  In addition, SKsh local variables  can
  211.                be turned off entirely to emulate the sh scoping rules.
  212.  
  213.  
  214.             Builtin Commands
  215.  
  216.                SKsh accomplishes many things  with  builtin  commands  that
  217.                ksh accomplishes with external binaries.  In addition,  Unix
  218.                has boatloads more of these  commands  than  the  Amiga  and
  219.                SKsh combined do or ever will.  If its on Unix, and  not  on
  220.                AmigaDos, you'll probably have to write it if you want it.
  221.  
  222.                In addition, many of  the  SKsh  commands  accept  different
  223.                parameters than  either  Unix  counterparts  with  the  same
  224.                name.  Some of  them  also  act  differently;  for  example,
  225.                'read' in Unix reads a single parameter  separated  by  IFS,
  226.                while 'read' in SKsh reads a whole line.
  227.  
  228.  
  229.             case...esac statement
  230.  
  231.                ksh supports a case...esac statement that SKsh does not.   I
  232.                can add this fairly easily, but I haven't done it yet  since
  233.                1) it would  make  SKsh  even  larger,  and  2)  it  can  be
  234.                simulated by using if...elif...else...fi statements.
  235.  
  236.  
  237.             until...do...done statement
  238.  
  239.                SKsh does not support this either.   I was  also  not  in  a
  240.                big hurry to add it, since it is  simply  a  while..do..done
  241.                statement with the test automatically inverted.
  242.  
  243.  
  244.             Parameter Breaks
  245.  
  246.                SKsh breaks parameters in different places  than  ksh.   For
  247.                example, 'foo'$foo is one  parameter  in  ksh,  but  two  in
  248.                SKsh.  To make it one in SKsh, use double quotes around  the
  249.                whole expression: "foo$foo", or use $(concat "foo" "$foo").
  250.  
  251.  
  252.             Standard Error Redirection
  253.  
  254.                Under AmigaDos, there is  no  distinction  between  standard
  255.                output and standard error.  Thus, you cannot  redirect  them
  256.                independently in SKsh.
  257.  
  258.  
  259.  
  260.  
  261.           SKSH Amiga Shell             Page 4          Ash/ksh Differences
  262.  
  263.  
  264.  
  265.